/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */

package cn.webrx;

import java.time.Month;
import java.time.Year;

/**
 * <p>Project: jse2303 - Switch2
 * <p>Powered by webrx On 2023-07-11 14:11:46
 * <p>描述：<p>
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Switch2 {
    public static void main(String[] args) {
        Year year = Year.of(2020);
        Month month = Month.of(2);
        int m = month.getValue();
        int days = 31;
        switch (m) {
            case 4:
            case 6:
            case 9:
            case 11:
                days = 30;
                break;
            case 2:
                days = year.isLeap() ? 29 : 28;
                break;
            default:
                days = 31;
                break;
        }
        System.out.printf("%d年%d月有%d天%n", year.getValue(), m, days);
    }
}
